# -*- coding: UTF-8 -*-
__author__ = 'xinhui1'


import urllib
import urllib2


def connect(username, password):
    url = r'http://ipgw.neu.edu.cn:803/srun_portal_pc.php?ac_id=1&url='
    data = dict(action='login', ac_id='1', user_ip='', nas_ip='', user_mac='', url='', username=username, password=password)

    post_data = urllib.urlencode(data)
    respond = urllib2.urlopen(url, post_data)
    content = respond.read()

    if content is None:
        return False
    else:
        return True

